package com.jh.user.pojo.freeQuick;

import java.util.Objects;

import static com.google.common.base.Strings.isNullOrEmpty;

public enum RegisterStatus {


    /**
     * 开通
     */
    ACTIVE("ACTIVE", "\u5f00\u901a"),

    /**
     * 待开通
     */
    INIT("INIT", "\u5f85\u5f00\u901a"),

    ;

    private final String code;
    private final String value;

    RegisterStatus(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }


    public static RegisterStatus of(String value) {
        if (isNullOrEmpty(value)) {
            return null;
        }
        for (RegisterStatus scc: values()) {
            if (Objects.equals(scc.getValue(), value)) {
                return scc;
            }
        }
        return null;
    }

    public static RegisterStatus code(String code) {
        if (isNullOrEmpty(code)) {
            return null;
        }
        for (RegisterStatus scc: values()) {
            if (Objects.equals(scc.getValue(), code)) {
                return scc;
            }
        }
        return null;
    }
}
